package com.kc.gb.device.events;

import com.kc.gb.device.common.adapter.DeviceAdaptor;
import com.kc.gb.device.common.dto.RefreshUIEvent;
import com.kc.gb.device.events.support.EmergencyEvent;
import com.kc.gb.device.service.DeviceMQService;
import com.kc.gb.device.service.HomeAdminService;
import com.kc.gb.device.tools.SSEStore;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;

import javax.annotation.Resource;

@Slf4j
@Configuration
public class EmergencyEventListener {

    @Resource
    DeviceAdaptor deviceAdaptor;

    @Resource
    DeviceMQService deviceMQService;

    @EventListener(value = EmergencyEvent.class)
    public void onRefresh(EmergencyEvent event) throws Exception {
        deviceMQService.sendFeedBackMessage(event);
    }
}
